package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.ArrayList;
import java.util.List;
import PUtilisateur.Utilisateur;

public final class AjoutUtilisateur_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

 List<Utilisateur> listUtilisateur = new ArrayList<Utilisateur>(); 
  private static java.util.List _jspx_dependants;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      PUtilisateur.ListeUtilisateur listeUtilisateur = null;
      synchronized (_jspx_page_context) {
        listeUtilisateur = (PUtilisateur.ListeUtilisateur) _jspx_page_context.getAttribute("listeUtilisateur", PageContext.PAGE_SCOPE);
        if (listeUtilisateur == null){
          listeUtilisateur = new PUtilisateur.ListeUtilisateur();
          _jspx_page_context.setAttribute("listeUtilisateur", listeUtilisateur, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
      out.write("<title>Liste Utilisateurs</title>\n");
      out.write("</head>\n");
      out.write("<body>\r\n");
      out.write("<h1>Ajout des utilisateurs</h1>\r\n");
      out.write("\r\n");
      out.write("<form action=\"\">\r\n");
      out.write("<TABLE BORDER=0>\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD>Nom</TD><TD><INPUT type=text name=\"nom\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD>Prénom</TD><TD><INPUT type=text name=\"prenom\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD>login</TD><TD><INPUT type=text name=\"login\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD>motDePasse</TD><TD><INPUT type=text name=\"motDePasse\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD>adresseMail</TD><TD><INPUT type=text name=\"adresseMail\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD COLSPAN=2><INPUT type=\"submit\" value=\"Envoyer\"></TD>\r\n");
      out.write("</TR>\r\n");
      out.write("</TABLE>\r\n");
      out.write("\r\n");
      out.write("</form>\r\n");

if(session.getAttribute("listeUtilisateur") != null)
	listUtilisateur = (ArrayList<Utilisateur>)session.getAttribute("listeUtilisateur");

	//listeUtilisateur.listUtilisateur.add(new Utilisateur(request.getParameter("nom"),request.getParameter("prenom"),request.getParameter("login"),request.getParameter("motDePasse"),request.getParameter("adresseMail")));
	listUtilisateur.add(new Utilisateur(request.getParameter("nom"),request.getParameter("prenom"),request.getParameter("login"),request.getParameter("motDePasse"),request.getParameter("adresseMail")));
	session.setAttribute("listeUtilisateur", listUtilisateur);

      out.write("\r\n");
      out.write("\r\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
